﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:y="clr-namespace:WeatherReaderMVC;assembly=WeatherReaderMVC"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    x:Class="WpfApplication1.Window1" ShowInTaskbar="False"
        AllowsTransparency="True" WindowStyle="None" Background="Transparent"
    Title="Window1"  HorizontalAlignment="Center" VerticalAlignment="Center" >
    <Grid  Name="grid" Background="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" >
        <Grid.RowDefinitions>
            <RowDefinition Height="14"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="14"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="14"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="14"/>
        </Grid.ColumnDefinitions>
        <Grid.Resources>
            <Style TargetType="Button"  x:Key="CloseButton" >
                <Style.Resources>
                    <ResourceDictionary />
                </Style.Resources>

                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Grid Name="cClose" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" VerticalAlignment="Top" 
									   HorizontalAlignment="Right" Margin="0,0,0,0">
                                <Rectangle Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Stroke="#FF361007" RadiusX="15" RadiusY="15" HorizontalAlignment="Center">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                            <LinearGradientBrush.GradientStops>
                                                <GradientStop Color="#FFac4b3b" Offset="0" />
                                                <GradientStop Color="#FFd37c61" Offset=".5" />
                                                <GradientStop Color="#FFac4b3b" Offset="1" />
                                            </LinearGradientBrush.GradientStops>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle Width="{TemplateBinding Width}" Height="10" HorizontalAlignment="Center" VerticalAlignment="Top" Fill="White" Opacity=".2" RadiusX="14" RadiusY="14" />
                                <TextBlock Name="tbCloseX" Foreground="White" FontSize="10" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Top">
                                    <TextBlock.BitmapEffect>
                                        <OuterGlowBitmapEffect GlowColor="LightSkyBlue" GlowSize="5" Opacity="0" />
                                    </TextBlock.BitmapEffect>
                                    X
                                </TextBlock>
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform x:Name="stCloseCanvas" />
                                    </TransformGroup>
                                </Grid.RenderTransform>
                                <Grid.Triggers>
                                    <EventTrigger RoutedEvent="Grid.MouseEnter">
                                        <EventTrigger.Actions>
                                            <BeginStoryboard>
                                                <Storyboard Storyboard.TargetName="tbCloseX">
                                                    <DoubleAnimation To=".9" Duration="0:0:0.2" Storyboard.TargetProperty="(TextBlock.BitmapEffect).(OuterGlowBitmapEffect.Opacity)" />
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger.Actions>
                                    </EventTrigger>
                                    <EventTrigger RoutedEvent="Grid.MouseLeave">
                                        <EventTrigger.Actions>
                                            <BeginStoryboard>
                                                <Storyboard Storyboard.TargetName="tbCloseX">
                                                    <DoubleAnimation To="0" Duration="0:0:0.2" Storyboard.TargetProperty="(TextBlock.BitmapEffect).(OuterGlowBitmapEffect.Opacity)" />
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger.Actions>
                                    </EventTrigger>
                                </Grid.Triggers>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>

            </Style>
        </Grid.Resources>
        <Thumb Name="t" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="0" Grid.RowSpan="3" Background="Transparent" Opacity="0.01" Cursor="Hand"/>

        <Button Style="{StaticResource CloseButton}" ToolTip="Close" Click="close_Click" Name="close" Height="15" Width="15" HorizontalAlignment="Right" Grid.Column="3" Grid.Row="1" VerticalAlignment="Top" Margin="0,15,0,0"/>
        <y:WeatherReaderUI Grid.Row="1" Minimized="False" HideMinimizeButton="False" Grid.RowSpan="2" Grid.ColumnSpan="2" Grid.Column="1" x:Name="ReaderTestInstance" d:LayoutOverrides="Height, GridBox" />

        <Thumb Name="topleft" Grid.Column="1"  Grid.Row="1"  Background="Transparent" Opacity="0.001" Cursor="Hand"/>
        <Thumb Name="topright" Grid.Column="2"  Grid.Row="1"  Background="Transparent" Opacity="0.001" IsHitTestVisible="False"/>
        <Thumb Name="bottomleft" Grid.Column="1"  Grid.Row="2"  Background="Transparent" Opacity="0.001" Cursor="Hand"/>
        <Thumb Name="bottomright" Grid.Column="2"  Grid.Row="2"  Background="Transparent" Opacity="0.001" Cursor="Hand"/>

    </Grid>
    <!--</StackPanel>-->
</Window>
